package com.fulu.springcloud.eurekaclient.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hi")
public class HiController {

    @Value("${server.port}")
    String port;

    @RequestMapping("")
    @HystrixCommand(fallbackMethod = "error")
    public String sayHi(@RequestParam(value = "name",defaultValue = "noname") String name){
        return "hi " + name + ",from port " + port;
    }

    public String error(String name){
        return "error" + name;
    }

}
